using Game.Archetype;
using Game.Config;
using Unity.Entities;
using Unity.Mathematics;
using UnityEngine;
using Random = Unity.Mathematics.Random;

namespace Game.Core
{
    public partial class SpawnSystem : SystemBase
    {
        Random m_Random;
        
        protected override void OnCreate()
        {
            m_Random.InitState();
            GameArchetype.InitArchetypes(World);
            PropertyConfig.InitPropertyData();
        }

        protected override void OnStartRunning()
        {
            
        }

        protected override void OnUpdate()
        {
            if (Input.GetKeyUp(KeyCode.N))
            {
                var pos = m_Random.NextFloat2(-10f, 10f);
                SpawnCapsule(new float3(pos.x, 1f,pos.y));
            }
        }

        protected override void OnDestroy()
        {
            PropertyConfig.ReleasePropertyData();
        }
    }
}

